#!/usr/local/bin/python2.7
class ParseError(Exception):
    pass

class WriteError(Exception):
    pass

class MissingFileError(ParseError):
    def __init__(self, filepath):
        self._filepath = filepath
        self._msg = 'Could not find file for parsing: '

    def __str__(self):
        return self._msg + self._filepath

    def getFilepath(self):
        return self._filepath
    filepath = property(getFilepath)

class NotZipFileError(ParseError):
    def __init__(self, filepath):
        self._filepath = filepath
        self._msg = 'File for parsing is not a Zip archive: '

    def __str__(self):
        return self._msg + self._filepath
    
    def getFilepath(self):
        return self._filepath
    filepath = property(getFilepath)

class PictureCopyError(ParseError):
    def __init__(self, filepath, imagename, error):
        self._filepath = filepath
        self._orig_error = error
        self._imagename = imagename
        self._msg = 'Failed to copy image from temp directory: '

    def __str__(self):
        return self._msg + self._imagepath + ' of ' + self._filepath
    
    def getFilepath(self):
        return self._filepath
    filepath = property(getFilepath)

class NoFilepathError(ParseError):
    def __init__(self):
        self._msg = 'Attribute \'filepath\' not specified.'

    def __str__(self):
        return self._msg
    
class TempDirExistsError(ParseError):
    def __init__(self, temp_path, curr_filepath):
        self._temp_path = temp_path
        self._curr_filepath = curr_filepath
        self._msg = 'Temp directory already exists: '

    def __str__(self):
        return self._msg + self._temp_path

    def getCurrFilepath(self):
        return self._curr_filepath
    curr_filepath = property(getCurrFilepath)
    
